Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circleQuestionMark and questionMarkPrefix on Linux #98

Merged
merged 1 commit into from
Oct 29, 2023

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Oct 29, 2023

The current intent of the circleQuestionMark and questionMarkPrefix symbols is to be displayed as circled question marks.
Unlike other symbols, this has an additional problem: this is not displayed correctly on some Linux distributions (like Ubuntu) but is displayed correctly on macOS.

The current logic has several problems. First, the condition platform === 'linux' should be inverted, since it currently shows the circled question mark only on Linux, instead of not on Linux.

figures/index.js

Lines 203 to 214 in 32fb096

// The main symbols for those do not look that good on Ubuntu.
...(
platform === 'linux'
? {
circleQuestionMark: '?⃝',
questionMarkPrefix: '?⃝',
}
: {
circleQuestionMark: '?',
questionMarkPrefix: '?',
}
),

Second, it leads replaceSymbols() to replace any normal question mark ? to (?). That's because replaceSymbols() was designed to replace symbols that are easily recognized as "graphical/UI" characters like or . But ? can be a normal punctuation character, which should not be replaced.

We could use (?) instead of ? as a non-fallback character on Linux, but that removes the ability of replaceSymbols() to replace circled question marks to (?), at least with the current implementation of replaceSymbols().

Sorry if this description is a little confusing. In a nutshell, this module is currently mostly using is-unicode-supported as a switch between fallback and non-fallback characters, and the current logic does not support well OS-specific characters. I initially considered adding a better support for OS-specific characters, but this is more complex that one might think. It appears the simplest solution is to just change the circleQuestionMark and questionMarkPrefix symbols.

Please note that CI tests on the main branch were failing due to this.

This PR implements the following fix: circleQuestionMark and questionMarkPrefix symbols are now always displayed as (?). Before they were displayed as circled question marks on macOS. I am not sure whether this should be considered a breaking change or not.

@sindresorhus sindresorhus merged commit 8b59acd into main Oct 29, 2023
12 checks passed
@sindresorhus sindresorhus deleted the fix-question-mark branch October 29, 2023 18:08
@sindresorhus
Copy link
Owner

This PR implements the following fix: circleQuestionMark and questionMarkPrefix symbols are now always displayed as (?). Before they were displayed as circled question marks on macOS. I am not sure whether this should be considered a breaking change or not.

Let's use the 10 seconds rule. We just did a major version. I'll note it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants